<!--
 * @Author: your name
 * @Date: 2020-09-02 11:14:32
 * @LastEditTime: 2020-09-24 17:18:08
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \admin-management\web\src\components\form-item\index.vue
-->
<template>
  <!-- type: 1 文本 2 数字 3 逻辑 4 下拉框 5 textarea 6 带角标输入框-->
  <a-form-item :label="item.label" v-if="item.type === 1">
    <a-input v-model:value="data[item.key]" allowClear />
  </a-form-item>
  <a-form-item :label="item.label" v-else-if="item.type === 2">
    <a-input type="number" v-model:value="data[item.key]" allowClear />
  </a-form-item>
  <a-form-item :label="item.label" v-else-if="item.type === 3">
    <CustomSwitch v-model:value="data[item.key]" />
  </a-form-item>
  <a-form-item :label="item.label" v-else-if="item.type === 4">
    <a-input v-model:value="data[item.key]" allowClear />
  </a-form-item>
  <a-form-item :label="item.label" v-else-if="item.type === 5">
    <a-textarea v-model:value="data[item.key]" allowClear />
  </a-form-item>
  <a-form-item :label="item.label" v-else-if="item.type === 6">
    <a-input
      v-model:value="data[item.key]"
      :prefix="item.prefix"
      :suffix="item.suffix"
      :placeholder="item.placeholder"
    />
  </a-form-item>
  <a-form-item :label="item.label" v-else-if="item.type === 7">
    <Kindeditor v-model:content="data[item.key]" />
  </a-form-item>
</template>

<script>
import CustomSwitch from './custom-switch';
import Kindeditor from '../kindeditor/index.vue';
export default {
  name: 'FormItem',
  components: {
    CustomSwitch,
    Kindeditor
  },
  props: {
    item: {
      type: Object,
      default: () => {}
    },
    data: {
      type: Object,
      default: () => {}
    }
  },
  setup(props, { emit }) {
    console.log(props.item);
    return {};
  }
};
</script>
